loan_type = input('请输入贷款类型(商业贷款,公积金贷款):')
loan_amount = float(input('请输入贷款金额(圆):'))
loan_period = float(input('请输入贷款期限(年):'))
if loan_type == '商业贷款':
    if loan_period <= 5:
        rate = 0.0475
    elif loan_period > 5:
        rate = 0.049
if loan_type == '公积金贷款':
    if loan_period <= 5:
        rate = 0.0275
    elif loan_period > 5:
        rate = 0.0325
else:
    raise ValueError("无效的贷款类型")
Monthly_payment = round(loan_amount * rate/12*(1+rate/12)**(loan_period*12)/((1+rate/12)**(loan_period*12)-1),3)
total_payment = Monthly_payment*loan_period*12
interest_payment = total_payment - loan_amount
print('每月月供参考:',Monthly_payment)
print('还款总额:',total_payment)
print('支付利息:',interest_payment)